All Questions
Tagged with commandtext-processing
17 questions
0votes
6answers
3kviews
How to cut string on last underscore character?
I have list of files like below: [root@ods1 backup]# ls -l total 93892810 -rw-r----- 1 root root 651248 Feb 17 08:34 abc_def_g_17-02-2022.sql -rw------- 1 root root 665248 Mar 23 08:46 bbc_23-03-...
0votes
1answer
467views
How to replace only specific 20 characters using sed
file.dat No Name Title Publisher Edition 1001 Programming in Java By BPB Balaguruswamy BPB Second 1002 Computer Networks ...
0votes
1answer
228views
Identify duration on log file
how to calculate duration of (Flushed time - Aggregated time) in the below log file using awk or perl scripts 09/03/2020 00:05:03.364 Aggregated 0 NMEs at a rate of 0 NMEs/sec 09/03/2020 00:05:03.366 ...
3votes
6answers
3kviews
How to add spaces in certain columns of a file in Linux
I have a text file containing 1000 lines in this format: 001122 abc def ghi 334455 xyz aaa bbb 667788 ccc ccc ddd How can I convert it into this format using a Linux command by adding spaces to ...
1vote
3answers
420views
Find the maximum value of Column3 and print the values of Column1 and 2 only
In Unix, I am trying to find a command that would find the maximum value in Column3 and print the corresponding values from Column2 and Column1 (but not from Column3) in a new file. Column1 ...
3votes
3answers
116views
Make a line blank, by returning everything on that line down in bash
I want to alter a text file. Let's say I have some text on line 22, and I want to make line 22 blank and move down the text on line 22 down to line 23. To illustrate, I want to turn this (printf 'Some ...
0votes
1answer
87views
How to replace matching words defined in one file on another file?
I have file1 and file2 as shown below, file1 (org8:0.00000001,org9:0.00000068,((org28:0.00137458,(org30:0.00146077,org4:0.00127170):0.00066024):0.00262422,(org14:0.00384582,(((org29:0.00000521,org7:...
0votes
1answer
55views
Extract some portion from line with regular expression
I have file which consist lines like : 50.57.61.8 - - [04/Apr/2019:09:52:01 -0400] "GET /tracker.php?q=1&p=2 HTTP/1.1" 302 20 "-" "Rackspace Monitoring/1.1 (https://monitoring.api.rackspacecloud....
7votes
8answers
36kviews
How to delete the first word in each line of a file?
consider a file names 'file.txt'. It contains the following. dove is a bird tiger is an animal cricket is a game. Expected output: is a bird is an animal is a game.
0votes
2answers
157views
How to combine two text formatting commands into one?
How does one combine two commands like the ones shown below into one command with one output file? first command: printf '%s\n' {001..500} input > output second command: sed 's/^/PREFIX /; s/$/ ...
-1votes
1answer
24views
How can I get a count of a Word called 'MSH' used multiple times in a file with a single UNIX command - AIX 6.1?
How can I get a count of a Word called MSH used multiple times in a file with a single UNIX command - AIX 6.1 ?
-2votes
2answers
365views
Why am I unable to save my output to a file from a command that takes input as the file itself? [duplicate]
For example, here's my command I'm using: tr -d '\n' < newfile.ppm I want to output the results to that exact same file, so I am now doing: tr -d '\n' < newfile.ppm > newfile.ppm Why is ...
0votes
2answers
363views
Command "paste - - - - ", how to specify a big column number
In command paste - - - -, numbers of - is equal the future column number. In my case, I have 55,000 future column, for me wont need to put 55,000 - what I will can use? Example: title1:A1 title2:A2 ...
0votes
4answers
4kviews
Remove first 2 columns from first row of a file
I am looking for a command to remove first 2 columns from the first row of a file. The delimiter for the columns is a pipe. Number of columns vary. we just need to blindly remove first 2 columns. ...
2votes
1answer
1kviews
Command to print few consecutive lines from middle of a file [duplicate]
For a file containing 20 lines, lines 6-10 can be printed using following command: head -10 filename | tail -5 Can this exactly same thing be done without using 'head' and 'tail' commands ?? Please ...